
     /**
      * 三联选择组件 查询归属地
      * @param prov 省
      * @param city 市
      * @param county 区
      */
      Vue.component('s-vest', {
        template: `
        <div class="form-group from-singplay">
          <slot></slot>
          <div class="tabel-show n3">
            <div class="cell-b">
              <select class="form-control" v-model="prov">
                <option v-for="t in provlist" :value="t.code" v-html="t.name"></option>
              </select>
            </div>
            <div class="cell-b">
              <select class="form-control" v-model="city">
                <option v-for="t in citylist" :value="t.code" v-html="t.name"></option>
              </select>
            </div>
            <div class="cell-b">
              <select class="form-control" v-model="county">
                <option v-for="t in countylist" :value="t.code" v-html="t.name"></option>
              </select>
            </div>
          </div>
        </div>
        `,
        props: ['prov', 'city', 'county','vestData'],
        created() {
          this.selProv();
        },
        data() {
          return {
            prov: 0,
            city: 0,
            county: 0,
            provlist: [{
                code: 0,
                name: '请选择'
            }],
            citylist: [{
                code: 0,
                name: '请选择'
            }],
            countylist: [{
                code: 0,
                name: '请选择'
            }],
          }
        },
        watch: {
          prov() {
            this.city = 0;
            this.county = 0;
            $.get('/region/city_list?province=' + this.prov)
            .then(data => this.citylist = JSON.parse(data))
            this.update()
          },
          city() {
            this.county = 0;
            $.get('/region/county_list?city=' + this.city)
            .then(data => this.countylist = JSON.parse(data))
            this.update()
          },
          county() {
            this.update()
          }
        },
        methods: {
          selProv() {
            $.get('/region/prov_list')
            .then(data => this.provlist = JSON.parse(data))
          },
          update() {
            this.$emit('update:prov', this.prov);
            this.$emit('update:city', this.city);
            this.$emit('update:county', this.county);
            this.$emit('update:vestData', {
              belong_province: this.prov,
              belong_province_name: this.sport(this.provlist, this.prov),
              belong_city: this.city,
              belong_city_name: this.sport(this.citylist, this.city),
              belong_county: this.county,
              belong_county_name: this.sport(this.countylist, this.county)
            })
          },
          sport(list, item){
            for(let i = 0; i< list.length; i++) {
              if(list[i].code == item){
                return ist[i].name
              }
            }
          }
        }
      })


   